<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Login</title>
<link href="./easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link href="./easyui/themes/icon.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body {
	background-color: #338fcc;
}
</style>
<script src="./easyui/jquery.min.js" type="text/javascript"></script>
<script src="./easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function() {
		$("#win").window({
			title : "Login",
			iconCls : 'icon-man',
			width : 300,
			height : 250,
			collapsible : false,
			minimizable : false,
			maximizable : false,
			closable : false,
			closed : false,
			draggable : false,
			resizable : false,
			modal : true
		});
	});
	function login() {
		var name = $("#txt_name").val();
		var psd = $("#txt_psd").val();
		var role = $("#role").val();
		if (name == "") {
			alert("账号为空");
			return false;
		}

		$.ajax({
			type : "POST",
			dataType : "json",
			url : "/studentmanagement/login/mgr.do",
			data : {
				Method : "Login",
				username : name,
				password : psd,
				role : role
			},
			success : function(data) {
				var status = data.status;
				if (status == 1) {//跳转到主页面
					window.location.href = "./mgr/main.html";
				} else {
					$.messager.alert("消息", data.message, "info");
				}
			},
			error : function() {
				$.messager.alert("消息", "错误！", "info");
			}
		});
	}
	function reset() {
		$("#txt_name").val("");
		$("#txt_psd").val("");
		$("#role option").eq(0).attr("selected", true);
		return false;
	}
</script>
</head>
<body>

	<form id="form1">

		<div id="win" class="easyui-window">
			<h2>管理员登录</h2>
			<div class="demo-info" style="margin-bottom: 10px">
				<div class="demo-tip icon-tip"></div>
				<div>请输入账号和密码登录系统</div>
			</div>
			<table>
				<tr>
					<td>账 号:</td>
					<td><input id="txt_name" type="text" /></td>
				</tr>
				<tr>
					<td>密 码:</td>
					<td><input id="txt_psd" type="password" /></td>
				</tr>
				<tr>
					<td>用户类型：</td>
					<td><select id="role">
							<option value="0">管理员</option>
							<option value="1">普通用户</option>
						</select></td>
				</tr>
				<tr align="center">
					<td><br /> <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="login()">登录</a></td>
					<td><br /> <a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="reset()">重置
						</a></td>
				</tr>

			</table>
		</div>
	</form>
</body>
</html>